﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Configuration;

namespace TCMS.Models.DBFatory
{
    public class DBConnection
    {
        public static MySqlConnection GetConnection()
        {
            var conString = ConfigurationManager.ConnectionStrings["LocalMySqlServer"];
            string con = conString.ConnectionString;
            MySqlConnection conn = new MySqlConnection(con);
            try
            {
                //Console.WriteLine("Connecting to MySQL...");
                conn.Open();
                return conn;
                // Perform database operations
            }
            catch (Exception ex)
            {
                return null;
            }

        }
    }
}